<template>
	<view class="cutContent Column">
		<view class="NullBox Row" v-if="this.historyList.length == 0">
			无记录
		</view>

		<view class="child Row" v-for="(item,index) in historyList" :key="index" v-else>
			<view class="Column">
				<view class="nickname">{{item.month}}月</view>
				<view class=""></view>
			</view>
			<view class="Row">奖励金额 <h4 class="h5CSS">{{item.reward_amount}}</h4>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		postMenu,
		getMenu
	} from '@/utils/api.js';
	export default {
		data() {
			return {
				historyList: [],
				current_page: 1,
				last_page: 1,
			};
		},
		onShow() {
			this.historyList = [];
			this.current_page = 1;
			this.last_page = 1;
			this.getDashboard();
		},
		methods: {
			redirect(Url) {
				uni.navigateTo({
					url: Url
				})
			},

			getDashboard() {
				let that = this;
				uni.$u.http.post('/kafu/dt_month_dividend/history', {
					page: that.current_page
				}).then(res => {
					if (res.code == 0) {
						uni.$u.toast(res.msg);
						return false;
					}
					that.historyList = res.data.data;
					that.last_page = res.data.last_page;
				}).catch(err => {
					console.log(err)
				})
			},
		},

		onReachBottom() {
			let that = this;
			that.current_page++;
			if (that.current_page > that.last_page) {
				uni.$u.toast("实在没有了～");
			} else {
				that.getDashboard();
			}
		}
	}
</script>

<style lang="scss">
	.cutContent {
		align-items: center;
		justify-content: space-between;
		width: 100%;

		.NullBox {
			justify-content: center;
			width: 100%;
			height: 100vh;
			font-size: 34rpx;
		}

		.child {
			justify-content: space-between;
			width: 94%;
			border-bottom: 2rpx solid #F5F6F8;
			padding: 25rpx 16rpx;

			.nickname {
				font-weight: 600;
			}

			.h5CSS {
				margin-left: 5px;
			}

			.text {
				color: #07235a;
				font-size: 28rpx;
			}
		}
	}
</style>